﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ZK.MGPInterface
{
    static class Program
    {
        public static Mutex mutex;
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            mutex = new Mutex(true, "MGPInterface");
            if (mutex.WaitOne(0, false))
            {
                try
                {
                    Common.Log4.LogManage.WriteInfo("this propram is start");
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    ////处理未捕获的异常
                    //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                    ////处理非UI线程异常
                    //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                    Application.Run(new Form1());
                }
                catch (Exception ex)
                {

                    Common.Log4.LogManage.WriteInfo("程序启动:" + ex.ToString());
                }
            }
            else
            {

                //MessageBox.Show(null, "运销系统CS客户端已经在运行!\n\n这个程序即将退出。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //// 提示信息，可以删除。   
                //Application.Exit();//退出程序   
            }
        }
    }
}
